package com.imu.purse.modules.trade.dao;

import java.util.List;
import org.apache.ibatis.annotations.Select;
import com.imu.purse.modules.trade.entity.TradeLogEntity;
import com.imu.core.base.BaseMapper;

/**
 * 交易流水
 * @author sunhongwei
 * @email sunhongwei@jshijian.com
 * @date 2018-03-22 10:33:21
 * Copyright (c) 2017 武汉极时间科技有限公司 版权所有 
 * Jshijian aloha CO.,LTD. All Rights Reserved. 
 */
public interface TradeLogMapper extends BaseMapper<TradeLogEntity>
{
	/**
     * 分页查询
     * @return
     */
	@Select({
		"<script>",
		    "SELECT id,",
					"pay_account, ",
					"pay_name, ",
					"rec_account, ",
					"rec_name, ",
					"order_no, ",
					"order_type, ",
					"order_state, ",
					"money, ",
					"order_create, ",
					"sign, ",
					"detail ",

		    "FROM imu_trade_log ",
		    "WHERE 1 = 1",
			"<when test = 'payAccount != null'>",
		    	"AND `pay_account` = #{payAccount}",
		    "</when>",
			"<when test = 'payName != null'>",
		    	"AND `pay_name` = #{payName}",
		    "</when>",
			"<when test = 'recAccount != null'>",
		    	"AND `rec_account` = #{recAccount}",
		    "</when>",
			"<when test = 'recName != null'>",
		    	"AND `rec_name` = #{recName}",
		    "</when>",
			"<when test = 'orderNo != null'>",
		    	"AND `order_no` = #{orderNo}",
		    "</when>",
			"<when test = 'orderType != null'>",
		    	"AND `order_type` = #{orderType}",
		    "</when>",
			"<when test = 'orderState != null'>",
		    	"AND `order_state` = #{orderState}",
		    "</when>",
			"<when test = 'money != null'>",
		    	"AND `money` = #{money}",
		    "</when>",
			"<when test = 'orderCreate != null'>",
		    	"AND `order_create` = #{orderCreate}",
		    "</when>",
			"<when test = 'sign != null'>",
		    	"AND `sign` = #{sign}",
		    "</when>",
			"<when test = 'detail != null'>",
		    	"AND `detail` = #{detail}",
		    "</when>",
		    "ORDER BY order_create DESC",
    	"</script>"
	})
    public List<TradeLogEntity> findByPage(final TradeLogEntity entity);	
}
